// 弹框的窗口id
var window = $("#window_uiFileLog");
var datagrid = null;
var columns = [[{
	field : 'fileId',
	title : '文件流水号',
	width : 75,
	align : 'center',
	formatter: function(value,row,index){
		return row.uiFileLog.fileId;
	}
}, {
	field : 'reqWjmc',
	title : '文件名称',
	width : 80,
	align : 'center',
	formatter: function(value,row,index){
		if(row.infoTxnLogMapping) {
			return row.uiFileLog.reqWjmc + "<br/>" + row.infoTxnLogMapping.receiveMsgId;
		}
		return row.uiFileLog.reqWjmc;
	}
}, {
	field : 'reqZbs',
	title : '总笔数',
	width : 20,
	align : 'center',
	formatter: function(value,row,index){
		return row.uiFileLog.reqZbs;
	}
}, {
	field : 'reqZje',
	title : '总金额',
	width : 25,
	align : 'center',
	formatter: function(value,row,index){
		return row.uiFileLog.reqZje;
	}
}, {
	field : 'sucCnt',
	title : '成功笔数',
	width : 20,
	align : 'center',
	formatter: function(value,row,index){
		return row.uiFileLog.sucCnt;
	}
},{
	field : 'sucAmt',
	title : '成功金额',
	width : 25,
	align : 'center',
	formatter: function(value,row,index){
		return row.uiFileLog.sucAmt;
	}
}, {
	field : 'failCnt',
	title : '失败笔数',
	width : 20,
	align : 'center',
	formatter: function(value,row,index){
		return row.uiFileLog.failCnt;
	}
}, {
	field : 'failAmt',
	title : '失败金额',
	width : 25,
	align : 'center',
	formatter: function(value,row,index){
		return row.uiFileLog.failAmt;
	}
}, {
	field : 'fileStatus',
	title : '文件状态',
	width : 25,
	align : 'center',
	formatter: function(value,row,index){
		return row.uiFileLog.fileStatus + "(" + row.uiFileLog.fileStatusRemarkDesc + ")";
	}
}, {
	field : 'status',
	title : '交易状态',
	width : 20,
	align : 'center',
	formatter: function(value,row,index){
		return row.uiFileLog.status;
	}
}, {
	field : 'createDateTimeDesc',
	title : '创建时间',
	width : 40,
	align : 'center',
	formatter: function(value,row,index){
		return row.uiFileLog.createDateTimeDesc;
	}
}, {
	field : 'remark',
	title : '备注',
	width : 30,
	align : 'center',
	formatter: function(value,row,index){
		return row.uiFileLog.remark;
	}
}, {
	field : "opt",
	title : '操          作',
	width : 25,
	align : 'center',
	formatter: function(value,row,index){
		return '<a href="#" iconCls="icon-search" style="margin-top:8px;margin-bottom:8px;" class="easyui-linkbutton" onclick=openDialog(\"' + row.uiFileLog.fileId + '\",\"' + row.uiFileLog.reqWjmc + '\")>查看详细</a>&nbsp;';
	}
}]];
function openDialog(fileId, reqWjmc) {
	jsp = "gcss/gddw/UiFileLogController/viewDetailForward.do?fileId=" + fileId;
	var content = "";
	//窗体标题
	var title = "批扣文件【  " + reqWjmc + " 】详细信息";
	var iframe = $("<iframe width=\"100%\" height=\"100%\" name='iframe' id=\"iframe\" frameborder=\"0\"/>");
	//初始化窗口
	iframe.attr({
		src :  jsp,
		width : '100%',
		height : '100%',
		frameborder : '0'
	});
	window = jq.window({
		title : title,
		height : 500,
		width : 1000,
		minimizable : false,
		modal : true,
		collapsible : false,
		maximizable : false,
		collapsible : true,
		draggable : true,
		resizable : false,
		contents : iframe,
		onComplete : function() {
			jq(this).mask({
				maskMsg : "页面加载中...",
				opacity : 1.0,
				timeout : 2500
			});
		},
		onClose : function() {
			datagrid.datagrid('unselectAll');
		}
	});
	
}
$(function() {
	var rows = null;
	datagrid = $('#table_uiFileLog').datagrid({
		url : 'query.do',
		fit : true,
		fitColumns : true,
		border : false,
		singleSelect : false,// 单选模式
		// 字体智能换行
		nowrap : true,
		striped : true,// 看文档
		columns : columns,
		title : "批扣文件信息列表",
		// 是否可以伸缩
		collapsible : false,
		pageSize : 10,
		pageList : [10, 50, 150, 200],
		loadMsg : '数据加载中请稍后……',
		pagination : true,
		// rownumbers : true,
		headerCls : "header",
		onLoadSuccess : function(data) {
			if (data.total == 0) {
				$.messager.show({
					msg : "没有相应的用户记录",
					title : '提示'
				});
			};
			$(".easyui-linkbutton").linkbutton();
			datagrid.datagrid('tooltip',['fileStatus', 'remark']);
		}
	});

	$("#btn_search").bind('click', function() {
		datagrid.datagrid('load', serializeForm($("#form2")));
		$(this).blur();
		return false;
	});
	$("#btn_clear").bind('click', function() {
		$("#form2").form('clear');
		datagrid.datagrid('unselectAll');
	});
	
});
